{
 "cells": [
  {
   "cell_type": "code",
   "id": "initial_id",
   "metadata": {
    "collapsed": true,
    "ExecuteTime": {
     "end_time": "2025-10-28T05:19:56.745372Z",
     "start_time": "2025-10-28T05:19:55.994380Z"
    }
   },
   "source": [
    "from sklearn.linear_model import LinearRegression\n",
    "import numpy as np\n",
    "from sklearn.metrics import mean_squared_error, r2_score"
   ],
   "outputs": [],
   "execution_count": 1
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-10-28T05:19:56.916516Z",
     "start_time": "2025-10-28T05:19:56.901776Z"
    }
   },
   "cell_type": "code",
   "source": [
    "model = LinearRegression()\n",
    "weight = np.array([[20],[40], [80], [100], [120], [140], [160]])\n",
    "age = np.array([1, 5, 10, 15, 19, 24, 28])\n",
    "model.fit(weight,age)\n",
    "predict_age = model.predict(np.array([[130]]))\n",
    "predict_age\n"
   ],
   "id": "ccb1b41d72c7834a",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([21.41666667])"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 2
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-10-28T05:19:56.978456Z",
     "start_time": "2025-10-28T05:19:56.964041Z"
    }
   },
   "cell_type": "code",
   "source": "mean_squared_error",
   "id": "898e264dd4ae08ae",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<function sklearn.metrics._regression.mean_squared_error(y_true, y_pred, *, sample_weight=None, multioutput='uniform_average')>"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 3
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
